package heven.holt.library.loading.delegate

import android.view.LayoutInflater
import android.view.ViewGroup
import heven.holt.library.databinding.LayoutErrorBinding
import heven.holt.library.loading.LoadingStateView

class ErrorViewDelegate(
    private val reloadListener: LoadingStateView.OnReloadListener
) : LoadingStateView.ViewDelegate<LoadingStateView.ViewHolder>() {
    private lateinit var binding: LayoutErrorBinding

    override fun onCreateViewHolder(
        inflater: LayoutInflater,
        parent: ViewGroup
    ): LoadingStateView.ViewHolder {
        binding = LayoutErrorBinding.inflate(inflater, parent, false)
        binding.btnReload.setOnClickListener {
            reloadListener.onReload()
        }
        return LoadingStateView.ViewHolder(binding.root)
    }

    override fun onBindViewHolder(holder: LoadingStateView.ViewHolder) {
    }
}